package com.asiainfo.work.controller;

import com.asiainfo.work.request.zentao.BugRequest;
import com.asiainfo.work.service.master.SingleStatisticsService;
import com.asiainfo.work.vo.SingleIndicatorStatistics;
import com.asiainfo.work.vo.TeamIndicatorStatistics;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: bf
 * @date: 2021/1/7-16:48
 * 指标统计controller
 */
@RestController
@Api(tags = "指标统计api")
@CrossOrigin
public class StatisticsController {

    @Autowired
    private SingleStatisticsService statisticsService;

    /**
     * 查询单人代码指标
     * @param bugRequest 请求参数
     * @return 返回单人代码指标集合
     */
    @PostMapping("singleStatistics")
    @ApiOperation(value = "单人指标统计", notes = "单人指标统计", httpMethod = "POST")
    public List<SingleIndicatorStatistics> singleStatistics(@RequestBody BugRequest bugRequest){

        return statisticsService.singleStatistics(bugRequest);
    }

    /**
     * 查询团队代码指标
     * @param bugRequest 请求参数
     * @return 返回团队代码指标集合
     */
    @PostMapping("teamStatistics")
    @ApiOperation(value = "团队指标统计", notes = "团队指标统计", httpMethod = "POST")
    public List<TeamIndicatorStatistics> teamStatistics(@RequestBody BugRequest bugRequest){

        return statisticsService.teamStatistics(bugRequest);
    }

}
